home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
DESK
/
CORE
/
Desk
/
h_doc
/
Print
< prev
next >
Wrap
Text File
|
1996-05-21
|
4KB
|
128 lines
/*
#### # # # #
# # # # # The FreeWare C library for
# # ## ### # # # # ### RISC OS machines
# # # # # # # # # # # ___________________________________
# # #### ### ## # # # #
# # # # # # # # # # Please refer to the accompanying
#### ### #### # # ##### # ### documentation for conditions of use
________________________________________________________________________
File: Print.h
Author: Copyright © 1995 Julian Smith
Version: 1.00 (20 Jan 1995)
Purpose: Automatic handling of RO 3 wimp printing protocol messages,
and some of the PDriver calls involved in printing.
*/
#ifndef __Desk_Print_h
#define __Desk_Print_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __Desk_Wimp_h
#include "Desk.Wimp.h"
#endif
#ifndef __Desk_PDriver_h
#include "Desk.PDriver.h"
#endif
typedef struct Desk_print_block {
void *reference; /* As passed to Desk_Print_StartPrint. */
char *jobtitle; /* As passed to Desk_Print_StartPrint. */
Desk_printer_info printerinfo; /* This info may be useful to printfn. */
Desk_print_job job; /* The current job handle. */
Desk_print_job oldjob; /* The previous job (if any). */
}
Desk_print_block;
enum {
Desk_print_result_OK = 0, /* Printing is finished. */
Desk_print_result_QUEUED, /* Data has been saved into printer queue. */
Desk_print_result_NEEDPRINTERMANAGER, /* printfn==NULL, but !Printers not running. */
Desk_print_result_PRINTERROR, /* Desk_message_PRINTERROR received. */
Desk_print_result_SAVEFAILED, /* savefn failed. */
Desk_print_result_CANTSAVE, /* savefn==NULL, !Printers busy */
Desk_print_result_CANTOPENPRINTER, /* Desk_File_Open( "Printer:") failed. */
Desk_print_result_FAILED /* Something else has gone wrong. */
};
typedef int Desk_print_result;
/* If result>255, it is an (Desk_os_error *), otherwise it is a Desk_print_result_* */
typedef Desk_bool (*Desk_print_printfn)( Desk_print_block *print);
typedef Desk_bool (*Desk_print_savefn)( Desk_print_block *print, Desk_message_datasaveack *datasaveack);
typedef void (*Desk_print_resultfn)( Desk_print_block *print, Desk_print_result result);
void Desk_Print_StartPrint(
Desk_print_printfn printfn, /* Called to do the actual printing after */
/* the wimp messageing has finished. */
Desk_print_savefn savefn, /* Called if print job is queued. */
Desk_print_resultfn resulfn, /* Always called. */
void *reference, /* Always passed to the above functions. */
int filetype, /* Used if print data is saved in queue. */
int estsize, /* Used if print data is saved in queue. */
char *leafname, /* Used if print data is saved in queue. */
char *jobtitle
);
/*
Call this function to start a printout. Desk_Print_StartPrint does all the
wimp message handling needed to start a print job, sets up the printer
driver and then calls 'printfn'.
Returns NOERROR if the print protocol was started ok. Otherwise returns
ERROR.
Note that 'jobtitle' is *not* strcpy-ed, so the string must be present
until printing has finished.
'printfn' should print the data. 'savefn' should save the data to a file
in a form that can be printed later - this is done if the print job
needs to be queued.
Both 'printfn' and 'savefn' should return ERROR or NOERROR (see
DeskLib:Core.h).
'resultfn' will always be called with the result of the print.
Pass NULL for printfn or savefn if you can't print directly or can't
save the data to a file. Obviously, if both printfn and savefn are NULL,
the print will fail.
'savefn' will be called if !Printers already has a queue, or if
'printfn'==NULL. In this case, !Printers prints the file itself when it
comes to top of printer queue if it can (eg a text file), else it
broadcasts Desk_message_PRINTTYPEODD. You should register an event handler
for Desk_message_PRINTTYPEODD if resultfn is told that the job has been
queued *and* savefn has saved the data in a non-standard format that
!Printers won't be able to print itself.
'printfn' will be called if !Printers is not running but there is a
printer driver loaded, or if !Printers has no queue of print jobs.
'resultfn' is always called, with a Desk_print_result. If greater than
256, it is an (Desk_os_error *) from a PDriver SWi.
*/
#ifdef __cplusplus
}
#endif
#endif